<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">

    <title>Registration</title>

    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet">

</head>

<body class="login-body">

<div class="container">

    <form class="form-signin" method="post" th:action="@{/regist}">
        <div class="form-signin-heading text-center">
            <h1 class="sign-title">新用户注册</h1>
            <img src="images/login-logo.png" alt=""/>
        </div>


        <p th:text="${msg}" style="color: red"></p>
        <div class="login-wrap">
            <p>输入您的个人信息</p>
            <input type="text" name="username" placeholder="姓名" required="required" class="form-control">
            <input type="text" name="uId" placeholder="学号或教师编号" required="required" class="form-control">
            <input type="password" id="password1" name="password" placeholder="密码" required="required" class="form-control">
            <label style="color:red;" id="msg"></label>
            <input type="password" id="password2" required="required" placeholder="确认密码" class="form-control">
            <p>选择账号类型</p>
            <div class="radios">
                <label for="radio-01" class="label_radio col-lg-6 col-sm-6">
                    <input type="radio" checked="" value="1" id="radio-01" name="privilege"> 学生
                </label>
                <label for="radio-02" class="label_radio col-lg-6 col-sm-6">
                    <input type="radio" value="2" id="radio-02" name="privilege"> 教师
                </label>
            </div>
            <button type="submit" id="regist" class="btn btn-lg btn-login btn-block">
                确认
            </button>

            <div class="registration">
                已经注册。
                <a href="login.html" class="">
                    去登陆
                </a>
            </div>

        </div>

    </form>

</div>



<!-- Placed js at the end of the document so the pages load faster -->

<!-- Placed js at the end of the document so the pages load faster -->
<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/modernizr.min.js"></script>

<script type="text/javascript">

    $(function () {
        $("#password2").change(function() {
            let pwd1 = $("#password1").val();
            let pwd2 = $(this).val();
            if(pwd1 !== pwd2) {
                $("#msg").html("两次密码不一致");
                $("#regist").addClass("disabled");
            } else {
                $("#regist").removeClass("disabled");
                $("#msg").html("");
            }
        });

    });

</script>

</body>
</html>
